package com.listen.common;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtil {
	/** 
	 * 通过正则表达式获取内容 
	 *  
	 * @param regex     正则表达式 
	 * @param from      原字符串 
	 * @return 
	 */  
	public static String[] regex(String regex, String from){  
	    Pattern pattern = Pattern.compile(regex);   
	    Matcher matcher = pattern.matcher(from);  
	    List<String> results = new ArrayList<String>();  
	    while(matcher.find()){  
	        for (int i = 0; i < matcher.groupCount(); i++) {  
	            results.add(matcher.group(i+1));  
	        }  
	    }  
	    return results.toArray(new String[]{});  
	}  
	
	public static String getZyByName(String name) {
		switch(name) {
		case "土建施工员":
			return "10";
		case "土建工程施工员":
			return "10";
		case "装饰装修施工员":
			return "11";
		case "设备安装施工员":
			return "12";
		case "市政工程施工员":
			return "13";
		case "市政施工员":
			return "13";
		case "标准员" :
			return "2";
		case "材料员" :
			return "3";
		case "机械员" :
			return "4";
		case "安全员" :
			return "5";
		case "资料员" :
			return "6";
		case "土建质量员" :
			return "70";
		case "土建工程质量员" :
			return "70";
		case "装饰装修质量员" :
			return "71";
		case "设备安装质量员" :
			return "72";
		case "市政工程质量员" :
			return "73";
		case "市政质量员" :
			return "73";
		case "劳务员" :
			return "8";
		default :
			return "8";
		}
	}
}
